package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DAOLogin 
{
	Connection connection;
	PreparedStatement comando;
	ResultSet result;
	
	public DAOLogin()
	{
		connection = ConnectionFactory.createConnection();
	}
	
	public boolean buscaLogin(String login, String senha) throws SQLException
	{
		boolean bRet = false;
		
		comando = connection.prepareStatement("SELECT * FROM usuarios WHERE email = ? AND senha = ?");
		
		comando.setString(1, login);
		comando.setString(2, senha);
		
		result = comando.executeQuery();
		
		if(result.next())
		{
			bRet = true;
		}
		
		return bRet;
	}
}
